package com.minisoft.utils;

import cn.hutool.core.io.FileUtil;
import cn.hutool.core.lang.Console;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import org.junit.Test;

import java.util.List;

/**
 * @author JueSu
 * @description: TODO
 * @date 2025/7/16 15:16
 */
public class SmsUtils {

    /**
     * {
     *     "createId": "测试",
     *     "message": "「金陵月华丨月华里」河西中双地铁口，约4.8m层高，约40㎡起全业态塔尖金铺，可餐饮，约95%高得房率，7月开盘！拒收请回复R",
     *     "mobile": "13580450193",
     *     "smsType": 1,
     *     "areaId": "1099008",
     *     "cityId": "1098014",
     *     "projectId": "00011404"
     * }
     * @throws Exception
     */
    @Test
    public void sendMessage() throws Exception {
        List<String> list = FileUtil.readUtf8Lines(this.getClass().getResource("/mobileFilter.txt"));
        for (String phone : list) {
            String msg = "「金陵月华丨月华里」河西中双地铁口，约4.8m层高，40㎡起塔尖金铺，部分可餐饮，约95%得房率，7月开盘！拒收请回复R";
            JSONObject message = JSONUtil.createObj()
                    .set("message", msg)
                    .set("mobile",phone)
                    .set("createId", "system")
                    .set("smsType", 1)
                    .set("areaId", "1099008")
                    .set("cityId", "1098014")
                    .set("projectId", "00011404");
            String result = HttpUtil.post("http://interact-center.paas4.huafagroup.com/message/singleSend", message.toString());
            Console.log("{}-{}",phone,result);
        }
    }
}
